#import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h"
#import <AdSupport/AdSupport.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {        
        NSString *idfa = @"";
        if (status == ATTrackingManagerAuthorizationStatusAuthorized) {
            idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
        }
        [[NSUserDefaults standardUserDefaults] setObject:idfa forKey:@"KDnpIDFA"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }];
}

@end
